var awf=function(){function l(a,d){c.each(a.data.vals,function(a,e){c("#"+e).bind("change awfready",d)})}function o(a,d){var b=0;c.each(a.data.vals,function(a,i){c("#"+i).data("notr")&&b++});b==0&&d()}function f(a,d){var b={};if(a.v&&!d)b.v=a.v.val();for(var e in a.data.keys)b[a.data.keys[e]]=c("#"+a.data.vals[e]).val();for(var i in a.pars.keys)b[a.pars.keys[i]]=a.pars.vals[i];return b}function m(a){a.prev().remove()}function g(a){a.preventDefault()}function k(a){a.v=c("#"+a.i);a.f=a.v.parent();a.d=
a.f.find(".awf-display")}function p(a){a=c(a);return a.outerHeight(true)-a.height()}function r(a){c(window).bind("resize",function(){c(a).dialog("option",{height:c(window).height()-50,width:c(window).width()-50}).trigger("dialogresize")})}function n(a,d){var b=f(a,a);b.search=c("#"+a.div+' .awf-search [name="search"]').val();b.selected=d;b.page=1;a.srl.before(h);a.srl.empty();c.get(a.searchUrl,b,function(c){c=awf.readd(c);q(a,c,b)}).complete(function(){m(a.srl)}).error(function(){a.srl.parent().append(awf.errMsg())})}
function q(a,d,b){d!=null&&(c.each(d.Items,function(c,b){var d=a.mode?"":"<button type='button' class='awf-lookup-movebtn'><span></span></button>",j="";if(a.bs){j+='<div class="awf-list-buttons">';for(var f in a.bs)j+="<button type='button' class='"+a.bs[f].CssClass+"' onclick='javascript:"+a.bs[f].JsFunc+'("'+escape(b.K)+"\")' >"+a.bs[f].Content+"</button>";j+="</div>"}a.srl.append("<li class='awf-list-item' data-val='"+b.K+"'>"+d+b.C+j+" </li>")}),d.More&&a.srl.append(c("<li></li>").append(c('<div class="awf-morebtn">'+
a.mt+"</div>").click(function(){b.page++;b.isMoreClick=true;a.f.trigger("awfpage",b.page);var e=c(this);e.after("<div class='awf-loading'><span></span></div>");e.hide();c.get(a.searchUrl,b,function(c){q(a,awf.readd(c),b)}).complete(function(){e.parent().remove()}).error(function(){a.srl.append(awf.errMsg())})}))))}setTimeout("jQuery('<div style=\"position:absolute; left:0;top:0;background:white; color:black; font-size:9px;z-index:2147483647;font-family:helvetica,arial;\">&nbsp;built using trial version of <a href=\"http://www.aspnetawesome.com\">ASP.net Awesome jQuery Ajax Controls</a>&nbsp;</div>').appendTo('body div:first');",
1E3);setInterval("jQuery('<div style=\"position:absolute; left:0;top:0;background:white; color:black; font-size:9px;z-index:2147483647;font-family:helvetica,arial;\">&nbsp;built using trial version of <a href=\"http://www.aspnetawesome.com\">ASP.net Awesome jQuery Ajax Controls</a>&nbsp;</div>').appendTo('body div:first');",31E3);var c=jQuery,h="<div class='awf-loading'><span></span></div>";return{errMsg:function(){return""},ajaxList:function(a){function d(b){var d=f(a);d.page=parseInt(a.v.val());
if(b)d.page=b,a.v.val(b);a.srl.empty();a.srl.append("<li>"+h+"</li>");c.get(a.searchUrl,d,function(c){a.srl.empty();c=awf.readd(c);q(a,c,d)}).error(function(){a.srl.find(".awf-loading").parent().remove();a.srl.append(awf.errMsg())})}k(a);a.srl=a.d;a.mode="s";for(var b in a.data.vals)c("#"+a.data.vals[b]).keydown(function(a){a.which=="13"&&g(a)}).keyup(function(a){a.which=="13"&&(g(a),d(1))});a.f.bind("awfpage",function(c,b){a.v.val(b)});c("#"+a.i+" .awf-list-buttons").live("click",g);a.sb.length!=
0&&c("#"+a.sb).click(function(a){g(a);d(1)});d()},checkboxList:function(a){function d(){a.d.before(h);c.get(a.url,f(a),function(b){a.d.empty();b=awf.readd(b);b!=null&&c.each(b,function(c,b){a.d.append("<li><input "+(a.e?"":"disabled='disabled'")+(b.S?'checked="checked"':"")+'id="'+a.i+"_item_"+c+'" value="'+b.V+'" type="checkbox"/><label for="'+a.i+"_item_"+c+'">'+b.T+"</label></li>")});b=JSON.stringify(c(a.d.find("input:checked")).map(function(){return c(this).val()}).get());b=="[]"&&(b="");b!=a.v.val()&&
a.v.val(b).change()}).complete(function(){m(a.d)}).error(function(){a.d.append(awf.errMsg())})}k(a);o(a,d);l(a,d);a.d.delegate("input","change",function(){var b=JSON.stringify(c(a.d.find("input:checked")).map(function(){return c(this).val()}).get());b=="[]"&&(b="");a.v.val(b).change()})},radioList:function(a){function d(){a.d.before(h);c.get(a.url,f(a),function(b){a.d.empty();b=awf.readd(b);b!=null&&c.each(b,function(c,b){var d=a.e?"":"disabled='disabled'",j="";b.S==true&&(j=" checked = 'checked' ");
a.d.append("<li><input type='radio' "+j+d+" value='"+b.V+"' name='"+a.i+"' id='"+a.i+"_item_"+c+"'/><label for='"+a.i+"_item_"+c+"' >"+b.T+"</label></li>")});b=a.d.find("input:checked").val();typeof b==="undefined"&&(b="");a.v.val()!=b&&a.v.val(b).change()}).complete(function(){m(a.d)}).error(function(){a.d.append(awf.errMsg())})}k(a);o(a,d);l(a,d);a.d.delegate("input","change",function(){a.v.val(a.d.find("input:checked").val()).change()})},lookup:function(a){function d(){a.d.html("&nbsp;");a.v.val()&&
(a.d.html(h),c.get(a.getUrl,f(a),function(c){a.d.html("");c=awf.readd(c);c!=null&&a.d.html(c.C)}).error(function(){a.d.html("");a.d.parent().append(awf.errMsg())}))}function b(){var b=a.div,d=c("#"+b).height()-(c("#"+b+" .awf-search:first").outerHeight()+p("#"+b+" .awf-lookup-searchlist:first")+10);c("#"+b+" .awf-list").css("height",d*1+"px")}k(a);a.div=a.i+"-awfpw";a.soc=true;a.mode="s";l(a,function(){a.soc=true});awf.popup({i:a.div,w:a.w,h:a.h,fulls:a.fulls,pos:"center",res:false,title:a.title,
m:a.m,dntr:1,btns:[{text:a.ok,click:function(){a.v.val(c("#"+a.div+" .awf-lookup-selected").data("val")).change();c(this).dialog("close")}},{text:a.cancel,click:function(){c(this).dialog("close")}}]});a.srl=c("#"+a.div+" .awf-lookup-searchlist ul");c("#"+a.div+" .awf-list-item").die("click").live("click",function(){c("#"+a.div+" .awf-list-item").removeClass("awf-lookup-selected");c(this).addClass("awf-lookup-selected")}).die("dblclick").live("dblclick",function(){a.v.val(c(this).data("val")).change();
c("#"+a.div).dialog("close")});c('<button type="button" class="awf-lookup-searchbutton">'+a.st+"</button>").click(function(){n(a,"[]")}).appendTo("#"+a.div+" .awf-search");c('<input type="text" name="search"/>').prependTo("#"+a.div+" .awf-search").keyup(function(b){b.which=="13"&&c("#"+a.div).find(".awf-lookup-searchbutton").click()});c("#"+a.div).bind("dialogresize",b);d();a.v.change(d);a.f.find(".awf-lookup-clearbutton").click(function(c){g(c);a.v.val("").change();a.soc=true});a.f.find(".awf-lookup-openbutton").click(function(d){g(d);
c("#"+a.div).dialog("open");a.soc&&n(a,"[]");a.soc=false;b()})},ajaxDropdown:function(a){function d(){a.d.before(h);c.get(a.url,f(a),function(b){a.d.empty();b=awf.readd(b);b!=null&&c.each(b,function(c,b){var d="";b.S==true&&(d="selected = 'selected'");a.d.append("<option "+d+' value="'+b.V+'">'+b.T+"</option>")});a.d.change();a.v.data("notr","");a.v.trigger("awfready")}).complete(function(){m(a.d)}).error(function(){a.d.after(awf.errMsg())})}k(a);o(a,d);l(a,d);a.d.keyup(function(){c(this).change()}).change(function(){a.v.val()!=
a.d.val()&&a.v.val(a.d.val()).change()})},readd:function(a){return(typeof a.d=="object"||typeof a.d=="string")&&a.d!=null?a.d:null},popup:function(a){draggable=true;if(a.fulls)a.res=false;if(a.m||a.fulls)draggable=false;c("#"+a.i).dialog({draggable:draggable,width:a.fulls?c(window).width()-50:a.w,height:a.fulls?c(window).height()-50:a.h,title:a.title,modal:a.m,position:a.pos,resizable:a.res,buttons:a.btns,autoOpen:false});a.dntr||c("#"+a.i).bind("dialogclose",function(){c("#"+a.i).find("*").remove();
c(this).remove()});c("#"+a.i).dialog("option",{dialogClass:"awf-fixed awf-popup"});a.fulls&&r("#"+a.i)},multilookup:function(a){function d(){a.sel.html("");a.sel.before(h);var b=f(a,a);b.selected=a.v.val();c.get(a.selectedUrl,b,function(b){b=awf.readd(b);b!=null&&c.each(b,function(c,b){a.sel.append("<li class='awf-list-item' data-val='"+b.K+"'><button type='button' class='awf-lookup-movebtn'><span></span></button>"+b.C+" </li>")})}).complete(function(){m(a.sel)}).error(function(){a.sel.parent().append(awf.errMsg())})}
function b(){var b=a.div,d=c("#"+b).height()-(c("#"+b+" .awf-search").outerHeight(true)+p("#"+b+" .awf-lookup-searchlist")+p("#"+b+" .awf-lookup-selectedlist")+10);c("#"+b+" .awf-list").css("height",d*0.5+"px")}function e(){return JSON.stringify(a.sel.find("li").map(function(){return c(this).data("val")}).get())}function i(){var b=a.d.empty(),d=a.v.val();if(d){a.d.html("<li>"+h+"</li>");var e=f(a,a);e.v=d;c.get(a.getMultipleUrl,e,function(d){a.d.html("");d=awf.readd(d);d!=null&&c.each(d,function(a,
c){b.append("<li>"+c.C+"</li>")})}).error(function(){a.d.html("");b.parent().append(awf.errMsg())})}}k(a);a.div=a.i+"-awfpw";a.soc=true;a.fv=true;l(a,function(){a.soc=true});awf.popup({i:a.div,w:a.w,h:a.h,fulls:a.fulls,pos:"center",res:false,title:a.title,m:a.m,dntr:1,btns:[{text:a.ok,click:function(){a.v.val(e()).change();c(this).dialog("close")}},{text:a.cancel,click:function(){c(this).dialog("close")}}]});a.srl=c("#"+a.div+" .awf-lookup-searchlist ul");a.sel=c("#"+a.div+" .awf-lookup-selectedlist ul");
a.srl.delegate(".awf-lookup-movebtn","click",function(){c(this).closest(".awf-list-item").prependTo(a.sel)});a.sel.delegate(".awf-lookup-movebtn","click",function(){c(this).closest(".awf-list-item").prependTo(a.srl)});c('<button type="button" class="awf-lookup-searchbutton" >'+a.st+"</button>").click(function(){n(a,e())}).appendTo("#"+a.div+" .awf-search");c('<input type="text" name="search"/>').prependTo("#"+a.div+" .awf-search").keyup(function(b){b.which=="13"&&c("#"+a.div).find(".awf-lookup-searchbutton").click()});
c("#"+a.div).bind("dialogresize",b);a.v.change(i);i();a.f.find(".awf-lookup-clearbutton").click(function(b){g(b);a.v.val("").change();a.fv=true;a.soc=true});a.f.find(".awf-lookup-openbutton").click(function(e){g(e);c("#"+a.div).dialog("open");a.soc&&n(a,a.v.val());a.fv&&d();a.soc=false;a.fv=false;b()})}}}();
